
using System;
using QdbUnit;
using Qdb;
using Qdb.Foundation.IO;
using Qdb.Tests.Common.Api;

namespace Qdb.Tests.Common.Api
{
	public class QdbEmbeddedTestCase : TestWithTempFile
	{
		public virtual void TestOpenFile()
		{
			IObjectContainer container = QdbEmbedded.OpenFile(QdbEmbedded.NewConfiguration(
				), TempFile());
			try
			{
				Assert.IsTrue(System.IO.File.Exists(TempFile()));
			}
			finally
			{
				container.Close();
			}
		}

		public virtual void TestOpenFileWithNullConfiguration()
		{
			Assert.Expect(typeof(ArgumentNullException), new _ICodeBlock_23(this));
		}

		private sealed class _ICodeBlock_23 : ICodeBlock
		{
			public _ICodeBlock_23(QdbEmbeddedTestCase _enclosing)
			{
				this._enclosing = _enclosing;
			}

			/// <exception cref="System.Exception"></exception>
			public void Run()
			{
				QdbEmbedded.OpenFile(null, this._enclosing.TempFile());
			}

			private readonly QdbEmbeddedTestCase _enclosing;
		}
	}
}
